Docker Engine
http://docs.docker.jp/v1.12/_images/engine-components-flow.png
プログラムがデーモンとの通信に使い、何をするか指示する
image, container, network, volume,...
Imageの実行
ローカルにイメージ(docker/whalesay)がなければDockerHubなどのレジストリからDLした後に実行される code:bash
docker run docker/whalesay cowsay boo
Imageの構築
code:Dockerfile
FROM docker/whalesay:latest
RUN apt-get -y update && apt-get install -y fortunes
CMD /usr/games/fortune -a | cowsay
Imageを構築する
code:bash
docker build -t docker-whale .
Imageを実行する
code:bash
docker run docker-whale
CLI
Copy
code: bash
docker cp -r ${container_id}:${input} ${output}
Run with mounting volumes
code: (bash)
docker run -v /home/hoge/shared:/shared-it ubuntu /bin/bash
Show dangling images
code: (bash)
docker image ls -f "dangling=true"
Build
code: bash
ls Dockerfile
docker build -t ${USER}/${tag} .
Prune
code: (bash)
docker container prune
docker volume prune
docker image prune
docker network prune
docker system prune
docker system prune --volumes
docker system prune --all --volumes -f
Tag
code:bash
docker login --username=${USER} --email=${EMAIL}
docker pull ${USER}/${image}
docker tag ${USER}/${image} ${USER}/${image}:${tag} # or ${image_id} ${USER}/${image}:${tag}
docker push ${USER}/${image}:${tag}
search tags of the image
code: (bash)
Reference